package com.yichen.ycapiclientSDK;

import com.yichen.ycapiclientSDK.client.YcApiClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
// 能够读取application.yml的配置,读取到配置之后,把这个读到的配置设置到我们这里的属性中,
// 这里给所有的配置加上前缀为"ycapi.client"
@ConfigurationProperties("ycapi.client")
@Data
// @ComponentScan 注解用于自动扫描组件，使得 Spring 能够自动注册相应的 Bean
@ComponentScan
public class YcApiClientConfig {

    private String accessKey;

    private String secretKey;

    @Bean
    public YcApiClient ycApiClient() {
        return new YcApiClient(accessKey, secretKey);
    }
}
